package main

import (
	"fmt"
	"time"
)

func main() {
	//没有缓冲空间的chan
	c := make(chan int)

	go func() {
		for i := 0; i < 10; i++ {
			c <- i
			fmt.Println("写入：", i)
		}
	}()

	go func() {
		for {
			m := <-c
			fmt.Println("读取：", m)
			time.Sleep(time.Second)
		}
	}()

	time.Sleep(10 * time.Second)
}
